use std::path::Path;
use anyhow::anyhow;

pub fn ensure_directory_exists(path_str: &str) -> anyhow::Result<()> {
    let path = Path::new(path_str);
    if path.exists() && path.is_dir() {
        Ok(())
    } else {
        Err(anyhow!("Path does not exist or is not a directory"))
    }
}